#pragma once

#include <QFrame>
#include <QLabel>
#include <QMouseEvent>
#include <vector>

#include "QFlowLayout.h"
#include "widgets.h"

class SFilterButton;
class SFilterTermRange;
class S_WIDGETS_EXPORT SFilterTermV : public QFrame {
  Q_OBJECT
 public:
  SFilterTermV(QWidget* p);

  void setName(const QString& sName);
  void setNameWidth(int width);
  void addTab(const QString& name);
  void selectTab(int index, bool bCtrlPress = false);
  void getSelTab(std::vector<int>& vctSel);
  int getTabCount();

  void getTermRange(QString& strStart, QString& strEnd, bool& bDateMode);

 Q_SIGNALS:
  void filterChanged();

 protected:
  void paintEvent(QPaintEvent* event) override;

 protected Q_SLOTS:
  void onFilterButtonClick();
  void onRangeChanged();

 protected:
  SFilterButton* m_buttons = nullptr;
  SFilterTermRange* m_range = nullptr;
  QString m_name;
  int m_nameWidth;
};
